A Database is a system created to organize,store, and retrieve large amounts of information and data easily.
There are three rules when creating a useful database: Normal Form: 1. First Normal Form – Data cannot appear in duplicate rows or columns 2. Second Normal Form – Each attribute is dependent on the entire primary key 3. Third Normal Form – Data can only be related to the primary key but not the attributes
First Normal Form
There is a problem with the following database table design. Identify the error and fix the design. (Answer: Duplicate rows of Data)
Solution
The original table is split into two separate tables to avoid having two duplicate rows of data.
Additional Example:
Solution
Second Normal Form
There is a problem with the following database table design. Identify the error and fix the design. (Answer: Each attribute must be dependent on the entire primary key, instead, use a composite primary key)
Solution
The original table is split into two separate tables. The first table include the composite key which combines two primary keys.
Additional Example:
Solution The original table is split into two separate tables. The first table include the composite key which combines two primary keys.
Third Normal Form
There is a problem with the following database table design. Identify the error and fix the design. (Answer: each attribute should be dependent on the primary key ONLY)
Solution
Additional Example:
Solution
This example's oringial table is also separated into two parts. The first table contains both primary key and foreign key. "School Name" is foreign key
because it is from the 2nd table. Entity Relationship Diagram
An Entity Relationship Diagram(ER Diagram) is a diagram that illustrates the interrelationships between entities of a database.
Entity Relationship Diagram:
Entity Relationship (ER) dragram rules:
1. A primary key cannot contain a null value
2. A non-primary key can contain a null value.
Note: Null value is a value that does not contain a number
An ER diagram can contain one-to-one relationships, one to many relationships, but not many to many relationships. The arrow in the above diagram illustrates the relationships.
Example: One to One relationship: A pair of shoe can only have one company name. One to Many Relationships: One customer can buy many video games.
One copy of video game can only be bought by one customer. Many to Many Relationships: One student can study many courses.
One course can contain many students.
Table of Contents
Database
A Database is a system created to organize,store, and retrieve large amounts of information and data easily.
There are three rules when creating a useful database:
Normal Form:
1. First Normal Form – Data cannot appear in duplicate rows or columns
2. Second Normal Form – Each attribute is dependent on the entire primary key
3. Third Normal Form – Data can only be related to the primary key but not the attributes
First Normal Form
There is a problem with the following database table design. Identify the error and fix the design.(Answer: Duplicate rows of Data)
Solution
The original table is split into two separate tables to avoid having two duplicate rows of data.
Additional Example:
Solution
Second Normal Form
There is a problem with the following database table design. Identify the error and fix the design.(Answer: Each attribute must be dependent on the entire primary key, instead, use a composite primary key)
Solution
The original table is split into two separate tables. The first table include the composite key which combines two primary keys.
Additional Example:
Solution
The original table is split into two separate tables. The first table include the composite key which combines two primary keys.
Third Normal Form
There is a problem with the following database table design. Identify the error and fix the design.(Answer: each attribute should be dependent on the primary key ONLY)
Solution
Additional Example:
Solution
This example's oringial table is also separated into two parts. The first table contains both primary key and foreign key. "School Name" is foreign key
because it is from the 2nd table.
Entity Relationship Diagram
An Entity Relationship Diagram(ER Diagram) is a diagram that illustrates the interrelationships between entities of a database.
Entity Relationship Diagram:
Entity Relationship (ER) dragram rules:
1. A primary key cannot contain a null value
2. A non-primary key can contain a null value.
Note: Null value is a value that does not contain a number
An ER diagram can contain one-to-one relationships, one to many relationships, but not many to many relationships. The arrow in the above diagram illustrates the relationships.
Example:
One to One relationship: A pair of shoe can only have one company name.
One to Many Relationships: One customer can buy many video games.
One copy of video game can only be bought by one customer.
Many to Many Relationships: One student can study many courses.
One course can contain many students.